<template>
	<view class="container">
		<uni-section>
			<view class="example">
				<!-- 基础用法，不包含校验规则 -->
				<uni-forms ref="baseForm" :modelValue="baseFormData" label-width="150rpx">
					<uni-forms-item label="患者姓名" required>
						<uni-easyinput disabled="" v-model="baseFormData.xm" placeholder="请输入姓名" />
					</uni-forms-item>
					<uni-forms-item label="性别" required>
						<uni-easyinput disabled="" v-model="baseFormData.xb" placeholder="请输入性别" />
					</uni-forms-item>
					<uni-forms-item label="年龄" required>
						<uni-easyinput disabled="" v-model="baseFormData.nl" placeholder="请输入年龄" />
					</uni-forms-item>
					<uni-forms-item label="呼吸" >
						<uni-easyinput  v-model="baseFormData.hx" placeholder="请输入呼吸" />
					</uni-forms-item>
					<uni-forms-item label="体温" >
						<uni-easyinput  v-model="baseFormData.tw" placeholder="请输入体温" />
					</uni-forms-item>
					<uni-forms-item label="脉搏" >
						<uni-easyinput  v-model="baseFormData.mb" placeholder="请输入脉搏" />
					</uni-forms-item>
					<uni-forms-item label="血压" >
						<uni-easyinput  v-model="baseFormData.xy" placeholder="请输入血压" />
					</uni-forms-item>
					<uni-forms-item label="神智" >
						<uni-easyinput  v-model="baseFormData.sz" placeholder="请输入神智" />
					</uni-forms-item>
					<uni-forms-item label="性质" >
						<uni-easyinput  v-model="baseFormData.xz" placeholder="请输入性质" />
					</uni-forms-item>
					<uni-forms-item label="输入量" >
						<uni-easyinput  v-model="baseFormData.srl" placeholder="请输入输入量" />
					</uni-forms-item>
					<uni-forms-item label="输出量" >
						<uni-easyinput  v-model="baseFormData.scl" placeholder="请输入输出量" />
					</uni-forms-item>
					<uni-forms-item label="备注" >
						<uni-easyinput type="textarea" v-model="baseFormData.bz" placeholder="请输入备注" />
					</uni-forms-item>
				</uni-forms>
			</view>
		</uni-section>
        <view class="fixedBottom">
			<button  @click="woundedSave()">保存</button>
			<button  @click="woundedList()">护理记录</button>
		</view>
	</view>
</template>

<script>
	import { addNursing } from '../../api/huanzhe.js'
	import { toast,useRouter } from '../../utils/utils.js'
	export default {
		data() {
			return {
				baseFormData:{}
			}
		},
		onLoad(option){
			var parameter=JSON.parse(option.data)
			this.baseFormData.xm=parameter.xm
			this.baseFormData.xb=parameter.xb
			this.baseFormData.nl=parameter.nl
			this.baseFormData.hzId=parameter.hzId
		},
		methods: {
			// 保存
			async woundedSave(){
			    await addNursing(this.baseFormData).then(res=>{
					const {
						hzId,xm,xb,nl
					}=this.baseFormData
					toast(res.msg)
					console.log(this.baseFormData);
						useRouter('/pages/nursing/index',{
							hzId,xm,xb,nl
						},'navigateTo')
				})
				this.baseFormData={}
			},
			// 护理记录
			woundedList(){
				useRouter('/pages/nursing/index',{
					hzId:this.baseFormData.hzId,
					xm:this.baseFormData.xm,
					xb:this.baseFormData.xb,
					nl:this.baseFormData.nl
				},'navigateTo')
			}
		}
	}
</script>

<style lang="scss">
.container{
	margin: 30rpx;
}
.fixedBottom{
		height: 200rpx;
		background-color: #FFF;
		position: fixed;
		bottom: 0rpx;
		left: 0;
		right: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		z-index: 50;
		button{
			width: 300rpx;
			height: 88rpx;
			color: white;
			background-color: #23440d;
			border-radius: 20px;
			line-height: 88rpx;
			text-align: center;
		}
	}
</style>
